﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="address.aspx.cs" Inherits="OF.Web.user.address" %>
<%@ Register Assembly="OF.Controls" Namespace="OF.Controls" TagPrefix="cc1" %>
<%@ Register Src="~/user/controls/left.ascx" TagPrefix="uc1" TagName="left" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
      <script src="/res/js/jquery-1.8.1.min.js" type="text/javascript"></script>
     <script src="/res/js/jsArea.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">

        <uc1:left runat="server" ID="left" />
        <div>
            <table class="table">
                <thead>
                    <tr>
                        <th>编号</th>
                      <%--  <th>省</th>
                        <th>市</th>
                        <th>区</th>
                        <th>学校</th>--%>
                        <th>地址</th>
                        <th>状态</th>
                        <th>编辑</th>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="repList" runat="server" OnItemCommand="repList_ItemCommand">
                        <ItemTemplate>
                            <tr>
                                <td><%#Eval("id") %></td>
                              <%--  <td><%#GetName(Eval("province")) %></td>
                                <td><%#GetName(Eval("city")) %></td>
                                <td><%#GetName(Eval("area")) %></td>
                                 <td><%#GetSchoolName(Eval("school")) %></td>--%>
                                <td><%#Eval("address") %></td>
                                 <td><%#GetState(Eval("state")) %></td>
                                <td><a href="javascript:edit(<%#Eval("id") %>,'<%#Eval("address")%>',<%#Eval("state")%>)">
                                    编辑</a>|
                                            <asp:LinkButton ID="btnDel" OnClientClick="return confirm('确定要删除么？');" runat="server"
                                                CommandArgument='<%#Eval("id") %>' CommandName="delete" Text="删除"></asp:LinkButton>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>


            <table>
              <%--  <tr>
                    <td>省市区、学校：</td>
                    <td>

                        <select id="ddlProvince">
                            <option value="">请选择</option>
                        </select>
                        <select id="ddlCity">
                            <option value="">请选择</option>
                        </select>
                        <select id="ddlDistrict">
                            <option value="">请选择</option>
                        </select>
                          <select id="ddlSchool">
                            <option value="">请选择</option>
                        </select>
                    </td>
                </tr>--%>

                <tr>
                    <td>地址：</td>
                    <td>
                        <cc1:OFTextBox ID="txtaddress" runat="server" class="form-control"></cc1:OFTextBox>
                    </td>
                </tr>
                <tr>
                    <td>状态：</td>
                    <td>
                        <asp:DropDownList ID="ddlState" runat="server">
                            <asp:ListItem Value="0">停用</asp:ListItem>
                            <asp:ListItem Value="1" Selected="True" >使用中</asp:ListItem>
                            <asp:ListItem Value="2">默认</asp:ListItem>
                        </asp:DropDownList></td>
                </tr>
                <tr>
                    <td>
                        <asp:HiddenField ID="hfid" runat="server" />
                        <asp:HiddenField ID="hfProvince" runat="server" />
                        <asp:HiddenField ID="hfCity" runat="server" />
                        <asp:HiddenField ID="hfDistrict" runat="server" />
                         <asp:HiddenField ID="hfSchool" runat="server" />
                        <asp:Button ID="btnSave" runat="server" Text="保存"  OnClick="btnSave_Click" />
                    </td>
                    <td></td>
                </tr>
            </table>
        </div>

        <script type="text/javascript">
            window.onload = function () {
                GetByJquery('', '', '','');
            }
            //function CheckAddr() {
            //    var p = $("#ddlProvince").val();
            //    var c = $("#ddlCity").val();
            //    var d = $("#ddlDistrict").val();
            //    var s = $("#ddlSchool").val();
            //    if (p == "" && $('#ddlProvince option').length > 1) {
            //        alert("请选择省");
            //        return false;
            //    }
            //    if (c == "" && $('#ddlCity option').length > 1) {
            //        alert("请选择市");
            //        return false;
            //    }
            //    if (d == "" && $('#ddlDistrict option').length > 1) {
            //        alert("请选择区");
            //        return false;
            //    }
            //    if (s == "" && $('#ddlSchool option').length > 1) {
            //        alert("请选择学校");
            //        return false;
            //    }
            //    $("#hfProvince").val(p);
            //    $("#hfCity").val(c);
            //    $("#hfDistrict").val(d);
            //    $("#hfSchool").val(s);
            //    return true;
            //}
            //province, city, area,school,
            function edit(id,address, state) {

              //  GetByJquery(province, city, area, school);
             //   GetCity(province, city, area,school);
                //if (city != "") {
                //    GetDistrict(city, area);
                //}
                //if (area != "") {
                //    GetSchool(area, school);
                //}
                $("#hfid").val(id);
                //$("#ddlProvince").val(province);
                //$("#ddlCity").val(city);
                //$("#ddlDistrict").val(area);
                //$("#ddlSchool").val(area);
                $("#txtaddress").val(address);
                $("#ddlState").val(state);
            }
        </script>
    </form>
</body>
</html>
